﻿using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;

namespace RI_Living
{
	// Token: 0x02000006 RID: 6
	public class WorkGiver_TakeRI_Resource_SilkwormCocoon : WorkGiver_Scanner
	{
		// Token: 0x1700000D RID: 13
		// (get) Token: 0x0600002A RID: 42 RVA: 0x00002A7C File Offset: 0x00000C7C
		public override ThingRequest PotentialWorkThingRequest
		{
			get
			{
				return ThingRequest.ForDef(this.def.GetModExtension<Building_FermentationDefMod>().BuildingDef);
			}
		}

		// Token: 0x0600002B RID: 43 RVA: 0x00002AA4 File Offset: 0x00000CA4
		public override bool ShouldSkip(Pawn pawn, bool forced = false)
		{
			List<Thing> list = pawn.Map.listerThings.ThingsOfDef(this.def.GetModExtension<Building_FermentationDefMod>().BuildingDef);
			for (int i = 0; i < list.Count; i++)
			{
				bool fermented = ((Building_Fermentation)list[i]).Fermented;
				if (fermented)
				{
					return false;
				}
			}
			return true;
		}

		// Token: 0x1700000E RID: 14
		// (get) Token: 0x0600002C RID: 44 RVA: 0x00002B0C File Offset: 0x00000D0C
		public override PathEndMode PathEndMode
		{
			get
			{
				return PathEndMode.Touch;
			}
		}

		// Token: 0x0600002D RID: 45 RVA: 0x00002B20 File Offset: 0x00000D20
		public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
		{
			Building_Fermentation building_Fermentation = t as Building_Fermentation;
			return building_Fermentation != null && building_Fermentation.Fermented && !t.IsBurning() && !t.IsForbidden(pawn) && pawn.CanReserve(t, 1, -1, null, forced);
		}

		// Token: 0x0600002E RID: 46 RVA: 0x00002B68 File Offset: 0x00000D68
		public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
		{
			return JobMaker.MakeJob(RI_LivingDefOf.TakeCocoonOutOfRI_Building_SilkwormRearingBox, t);
		}
	}
}
